﻿/*
    Write a program that, for a given two integer numbers n and x, calculates the sum S = 1 + 1!/x + 2!/x2 + … + n!/xn.
    Use only one loop. Print the result with 5 digits after the decimal point.
 */

using System;
using System.Numerics;

class SumOfNX
{
    private static double Factoriel(double n)
    {
        double factN = 1;
        while (n > 1)
        {
            factN = factN * (n);
            n = n - 1;
        }
        return factN;
    }
    static void Main()
    {
        double n = double.Parse(Console.ReadLine());
        double x = double.Parse(Console.ReadLine());
        double sum = 1;
        double answer;
        double top;
        double bottom;
        for (double i = 1; i <= n; i++)
        {
            top = Factoriel(i);
            bottom = Math.Pow(x, i);
            answer = top / bottom;
            sum = sum + answer;
        }
        Console.WriteLine(sum);
    }

}
